-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AutoinstallError exception #1897
AutoinstallError exception #1897
Conversation
Move the assignment of autoinstall_default to the relevant block where it's being tested.
Provided autoinstall data is already validated against a specific schema by the relevant controller, but these schemas themselves are never validated against a meta schema to guarantee they are valid JSON schemas. This patch adds unit tests for each controller, as well as SubiquityServer, to validate their autoinstall schema against the latest JSON meta schema draft (that is supported in jsonschema). A particular draft validator can be used instead by specifying meta schema in the schema definition.
933f05d
to
c8d911a
Compare
Commit f6a7819 is a little big and I'm tempted to create a separate PR for it. Although it's mostly repeated lines to just test the the json schemas defined by the controllers are valid. Testing this is generally important, but |
c8d911a
to
378a373
Compare
I updated the commit adding |
SubiquityServer is responsible for checking and loading the interactive-sessions, so it should be responsible for validating this section as well. Additionally add this to the autoinstall schema in the docs.
378a373
to
34ffe1f
Compare
Rebased to not conflict with #1898 |
Adds a base exception type for Autoinstall related failures and a specific implementation for autoinstall validation failures. When a user passes incorrect autoinstall data, the installer will crash with an AutoinstallValidationError exception. Failure messages are currently in the form of: "Malformed autoinstall in '<autoinstall_key>' section" where <autoinstall_key> is the name of the top-level key a particular controller is responsible (e.g., 'apt' and MirrorController). The section reporting is a little crude in the validation of the base schema done by SubiquityServer, which can't discern between the 'interative-sessions' and 'version' keys, but for now the scope is pretty limited and can be fixed up at a later time.
34ffe1f
to
423a13d
Compare
I simplified the new exception types a bit and added handling to explicitly not generate an apport report when failing on an instance of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One item to review then I think this is ready.
Autoinstall related failures are more likely than not going to be user caused, so we shouldn't immediately generate a crash report for these types of failures. This should hopefully allow the user to debug their autoinstall data much faster and reduce the number of autoinstall-related bugs reported.
423a13d
to
24de248
Compare
Adds a special exception for Autoinstall related failures and a
specific implementation for autoinstall validation failures.
When a user passes incorrect autoinstall data, the generated
bug report will be titled:
Where the traceback will start with a hint on the offending
section. For example:
Information from the original jsonschema ValidationError is
also available in the traceback to point to specific issues
with the provided data.
The section reporting is a little crude in the validation
of the base schema done by SubiquityServer, which can't discern
between the 'interative-sessions' and 'version' keys, but for now
the scope is pretty limited and can be fixed up at a later time.